<?php $this->load->view('config/header');?>
<h1>Product <small>form entry</small></h1>
<ol class="breadcrumb">
  <li><a href="<?php echo site_url()?>home"><i class="icon-dashboard"></i> Dashboard</a></li>
  <li><a href="<?php echo site_url()?>product"><i class="icon-table"></i> Product</a></li>
  <li class="active"><i class="icon-file-alt"></i> Form <?php echo $mode; ?></li>
</ol>

<form class="form-horizontal" role="form" method="post" action="<?php echo site_url() ?>product/<?php echo $action; ?>" enctype="multipart/form-data">
	<input type="hidden" class="form-control" name="id_product" value="<?php echo @$detail[0]['id_product']?>">
	<input type="hidden" class="form-control" name="date_product" value="<?php echo @$detail[0]['date_product']?>">
	<div class="form-group">
		<label for="id_submenu" class="col-lg-2 control-label">Menu</label>
		<div class="col-lg-6">
			<select class="form-control" name="id_submenu">
				<?php if (@$submenu):?>
					<?php foreach ($submenu as $row):?>
						<?php if ($row['id_submenu'] == @$detail[0]['id_submenu']):?>
							<?php $selected =  'selected="selected"' ?>
						<?php else :?>
							<?php $selected =  '' ?>
						<?php endif;?>
						<option value="<?php echo $row['id_submenu'] ?>" <?php echo $selected ?> ><?php echo $row['nama_submenu'] ?></option>
					<?php endforeach?>
				<?php else :?>	
					<option value="">Belum ada Menu</option>
				<?php endif?>
			</select>
		</div>
	</div>
	<div class="form-group">
		<label for="title_product" class="col-lg-2 control-label">Name Product</label>
		<div class="col-lg-6">
			<input type="text" class="form-control" name="title_product" value="<?php echo @$detail[0]['title_product']?>" >
		</div>
	</div>
	
	<div class="form-group">
		<label for="cost_product" class="col-lg-2 control-label">Cost Product</label>
		<div class="col-lg-3">
			<input type="text" class="form-control" name="cost_product" value="<?php echo @$detail[0]['cost_product']?>" >
		</div>
	</div>
	<div class="form-group">
		<label for="file_product" class="col-lg-2 control-label">File Product</label>
		<div class="col-lg-6">
			<?php if(@$detail[0]['file_product'] == "" || @$detail[0]['file_product'] == "0"):?>
				<input type="file" class="form-control" name="file_product"></input>
			<?php else:?>
				<input type="text" class="form-control" name="file_product" value="<?php echo @$detail[0]['file_product']?>" readonly="readonly"/>
			<?php endif;?>
		</div>
	</div>
	<div class="form-group">
		<label for="text_product" class="col-lg-2 control-label">Description Product</label>
		<div class="col-lg-10">
			<textarea class="ckeditor" name="text_product">
				<?php echo @$detail[0]['text_product']?>
			</textarea>
		</div>
	</div>
	<div class="form-group">
		<label for="enable_product" class="col-lg-2 control-label">Enable</label>
		<div class="col-lg-2">
			<?php $selected1 =  ''; ?>
			<?php $selected2 =  ''; ?>
			<select class="form-control" name="enable_product">
				<?php if (@$detail[0]['enable_product'] == 1):?>
					<?php $selected1 =  'selected="selected"' ?>
				<?php elseif (@$detail[0]['enable_product'] == 0):?>
					<?php $selected2 =  'selected="selected"' ?>
				<?php else :?>
					<?php $selected1 =  ''; ?>
					<?php $selected2 =  ''; ?>
				<?php endif;?>
				<option value="1" <?php echo $selected1; ?> >Aktif</option>
				<option value="0" <?php echo $selected2; ?> >Non Aktif</option>
			</select>
		</div>
	</div>
	<div class="form-group">
		<div class="col-lg-offset-2 col-lg-10">
			<input type="submit" name="submit" value="Simpan" class="btn btn-primary"/>
			<a href="<?php echo site_url()?>product" class="btn btn-primary">Batal</a>
		</div>
	</div>
</form>

<?php $this->load->view('config/footer');?>